# services/log_service.py
from models.operation_log import OperationLog


class BalanceLog(OperationLog):
    def __init__(self, user, page, product, payment):
        super().__init__(user, page, product, payment)

    def get_cost_description(self):
        # 使用 self.product 来拼接描述
        return (
            f"购买了{self.product.quantity}{self.product.unit}{self.product.name}，"
            f"花费{self.product.total_price}元"
        )


class CashLog(OperationLog):
    def __init__(self, user, page, product, payment):
        super().__init__(user, page, product, payment)

    def get_cost_description(self):
        return (
            f"购买了{self.product.quantity}{self.product.unit}{self.product.name}，"
            f"现结{self.product.total_price}元"
        )


class PointsLog(OperationLog):
    def __init__(self, user, page, product, payment):
        super().__init__(user, page, product, payment)

    def get_cost_description(self):
        # 假设是“1次宠物养护服务”，或者“2次宠物养护服务”
        return (
            f"兑换了{self.product.quantity}{self.product.unit}{self.product.name}，"
            f"花费{self.product.total_price}积分"
        )
